package ut.servlet.member;
import ut.data.User;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
public class CreateMessage extends HttpServlet{
	// 使用者發送私人訊息，此功能暫時不用
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		/*
		request.setCharacterEncoding("utf-8");
		// 取得並驗證使用者輸入資訊
		int receiverId;
		String content;
		if(request.getParameter("receiver_id") == null || request.getParameter("content") == null){
			return;
		}else{
			try{
				receiverId = Integer.parseInt(request.getParameter("receiver_id"));
			}catch(NumberFormatException e){
				return;
			}
			content = request.getParameter("content").replace("&", "&amp;").replace("\"", "&quot;").replace("<", "&lt;").replace(">", "&gt;");
			content = content.replace("\r\n", "<br/>").replace("\n", "<br/>").replace("\r", "<br/>");
		}
		// 確認使用者已經完成信箱驗證
		User user = (User)request.getSession().getAttribute("user");
		if(user.verify == 0){
			return;
		}
		// 更新資料庫
		response.setHeader("result", ut.data.Message.createMessage(user, receiverId, content) + ""); // true: 成功、false: 失敗
		*/
	}
}